﻿using Acme.BookStore.BallDto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;

namespace Acme.BookStore.Ball
{
    public class BallAppService : CrudAppService<
        BallModel, BallDto.BallDto, Guid, PagedAndSortedResultRequestDto, CreateUpdateBallDto>,
        IBallAppService
    {
        public BallAppService(IRepository<BallModel, Guid> repository) : base(repository)
        {
            // 这里可以添加额外的初始化代码
        }

        /// <summary>
        /// 品牌查询
        /// </summary>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<ListResultDto<IBallAppService.BallBrandLookDto>> GetBallBrandAsync()
        {
            var brands=Enum.GetValues<BallBrand>()
                .Select(x=>new IBallAppService.BallBrandLookDto { 
                    Id=(int)x,
                    Name=x.ToString()
                }).ToList();
               return new ListResultDto<IBallAppService.BallBrandLookDto>(brands);
        }

        /// <summary>
        /// 类型查询
        /// </summary>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<ListResultDto<IBallAppService.BallTypeLookDto>> GetBallTypeAsync()
        {
            var types = Enum.GetValues<BallType>()
                .Select(x => new IBallAppService.BallTypeLookDto
                {
                    Id = (int)x,
                    Name = x.ToString()
                }).ToList();
            return new ListResultDto<IBallAppService.BallTypeLookDto>(types);
        }
    }
}
